<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<input type="hidden" value="${model.phase}" name="phase">
<div class="form-horizontal">
    <div class="form-group">
        <label class="control-label col-md-2">期数</label>
        <div class="col-md-4">
            <input type="text" id="num" name="num" class="form-control" value="${model.num}" placeholder="请输入期数"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">类型</label>
        <div class="col-md-4">
            <select name="type" id="type" class="form-control">
                <option value="-1">请选择</option>
                <option value="1" <c:if test="${model.type==1}"> selected="selected"</c:if>>书籍</option>
                <option value="2" <c:if test="${model.type==2}"> selected="selected"</c:if>>会员</option>
            </select>
        </div>
    </div>
</div>
<div class="form-group">
    <div class="col-md-offset-2 col-md-10">
        <button type="submit" class="btn btn-primary">
            <i class="fa fa-floppy-o"></i> 保存
        </button>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#form1").bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                num: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        },
                        regexp: {
                            regexp: /^[1-9]\d*$/,
                            message: '非0正整数'
                        }
                    }
                },
                type: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        },
                        regexp: {
                            regexp: /^[1-2]*$/,
                            message: '必须选择其中的一个'
                        }
                    }
                }
            }
        });
    });
</script>